{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'question': '那你说怎么处理的', 'pos_response': '您可以查看我为您提供的解决思路，如果没有帮到您或未准确识别您遇到的问题，您可以试着重新提问。', 'neg_response': '小优来自中国北京。'}\n"
     ]
    }
   ],
   "source": [
    "filep =\"chatbot_specific.txt\"\n",
    "i = 0\n",
    "with open(filep,'r',encoding='utf-8') as fr:\n",
    "    datas = []\n",
    "    for line in fr:\n",
    "        if i==1000:\n",
    "            break\n",
    "        con = json.loads(line)\n",
    "        print(con)\n",
    "        i+=1\n",
    "        datas.append([con[\"pos_response\"],con[\"question\"],1])\n",
    "        datas.append([con[\"pos_response\"],con[\"question\"],0])\n",
    "    \n",
    "#         break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[[ 0.5808, -0.6778,  1.3977,  0.0981],\n",
       "         [-0.7437,  1.5410, -0.1607,  0.6362],\n",
       "         [ 1.0180,  0.5307,  0.5661, -0.5438]],\n",
       "\n",
       "        [[ 1.6853,  1.4470,  1.9676, -0.9875],\n",
       "         [ 0.7384,  0.0227, -0.7531,  1.5233],\n",
       "         [ 0.1754,  0.1061, -0.5602, -0.0652]]])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x= torch.randn([2,3,4])\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[ 0.5808, -0.6778,  1.3977,  0.0981],\n",
      "        [ 1.6853,  1.4470,  1.9676, -0.9875]])\n"
     ]
    }
   ],
   "source": [
    "print(x[:,0,:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
